<include file="__THEME__/header" />
<div class="content no_bg2"><!-- 内容 begin  --> 
  <include file="__THEME__/shop_menu" />
  <div class="shop_right">
    <div class="mainbox">
      <div class="mainbox_C no_r">
    
          <div class="add_app">
           <h1>{$goods['title']}</h1> 
          
         <table width="98%" border="0" cellspacing="0" cellpadding="0" class="add_app_qbox">
  <tr>
    <td width="15%"><span>商品名称：</span></td>
    <td width="35%"><php>if($uid==$mid){</php> 
               <h3 class="right"> <a href="{:U('home/Myqiugou/edit',array('id'=>$goods['id']))}">编辑</a></h3>
                <php>}</php>{$goods['gname']}  </td>
    <td width="15%"><span>价格：</span></td>
    <td width="35%"><em>￥{$goods['gprice']}</em></td>
  </tr>
  <tr>
    <td><span>所在地区：</span></td>
    <td>{$goods['location']}</td>
    <td><span>数量:</span></td>
    <td><em>{$goods['gnumber']}</em></td>
  </tr>
  <tr>
    <td><span>所在学校：</span></td>
    <td>{$goods['school']}</td>
    <td><span>创建时间：</span></td>
    <td>{$goods['ctime']|friendlyDate}</td>
  </tr>
  <tr>
    <td><span>浏览次数：</span></td>
    <td>{$goods['gscan']}次</td>
    <td><span>最后修改：</span></td>
    <td>{$goods['utime']|friendlyDate}</td>
  </tr>
</table>
</div>
<div class="xq-menu">
           <ul><li>
           商品详细信息</li>
           </ul>
</div>
         <div class="xq_details">{$goods['gdetails']}</div>
         <div class="xq-menu">
           <ul><li>
           留言评论</li>
           </ul></div>
           <php>if($mid){</php>
         <div class="message"> 
         <input name="goods_id" value="{$goods['id']}" type="hidden" id="goods_id"/>
         <textarea name="message" style="width: 98%;" rows="3"cols="" class="message_text text" id="shop_Lw"></textarea>
         
         <input type="submit" name="savelw" id="savelw"  value="发表留言" class="N_but right" onclick="doAddLw()"/>
         
         </div><php>}</php>
         <div id="lw_list">
         <php>if($lwlist){</php>
         <volist name="lwlist" id="vo">
         <div class="message" id="lw_{$vo['id']}"> 
       <ul>
        <li>
        <em><php>if($uid==$mid || $vo['from_uid']==$mid){</php><a href="javascript:void(0);"  onclick="ui.confirm(this,'确认要删除这条留言?')" callback="Del({$vo['id']});">删除</a><php>}</php> {$vo['ctime']|friendlyDate}</em>
         <space uid="vo.from_uid">{uavatar=s}</space>
          {$vo['from_uname']}:  </li>
          <p class="message_text">{$vo['message']}</p>
        </ul>
          </div>
          </volist>
          <php>}else{</php>
          <br/>
          无留言信息
          <php>}</php>
        </div>
        </div>
      </div>
    </div>
  </div>
  <div class="c"></div>
</div>
<script>

function doAddLw(){
	var content = $("#shop_Lw").val();
	var goods_id = $("#goods_id").val();	
	if($.trim(content) ==''){
		ui.error('留言内容不能为空');
		return false;
	}else if(content.length >100){
		ui.error('留言内容不能超过100字');
		return false;
	}
	$.post(U('shop/Index/add_Lw_qg'),{goods_id:goods_id,message:content},function(rel){
		if(rel==0){
			ui.error('留言失败');	
		}else{
		 var mid = "{$mid}";
		 var html = '';
            html += '<div class="message" id="lw_'+rel+'"><ul><li>';
			html += '<em><php>if($uid==$mid){</php><a href="javascript:void(0);" onclick="Del('+rel+');">删除</a><php>}</php> 刚刚</em>';
            html += "<space uid="mid">{uavatar=s}</space>";
			html += ' 我:  </li>';
            html += '<p class="message_text">'+content+'</p>';
           
            html += ' </ul> </div>';
            $("#lw_list").prepend(html);
        
		ui.success('留言成功');
		ui.box.close();			
		}
		});
 }
function Del (lw_id) {
	
	$.post(U('shop/Index/Del_lw'),{lw_id:lw_id},function(rel){
		
		if(rel == 1){
			$('#lw_'+lw_id).remove();
			ui.success('删除成功');
			ui.box.close();
			}else{
			ui.error('删除失败');	
		}
	  });
		
	}
</script>
<include file="__THEME__/footer" /> 